<%@Page Language="VB" %>
<%@Import Namespace="System.Web.Security" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title>Create Password Hash for web.config File</title>
<style type="text/css">
body {font-family:Tahoma,Arial,sans-serif; font-size:10pt}
input {font-family:Tahoma,Arial,sans-serif; font-size:9pt}
.heading {font-family:Tahoma,Arial,sans-serif; font-size:14pt; font-weight:bold}
.subhead {font-family:Tahoma,Arial,sans-serif; font-size:12pt; font-weight:bold; padding-bottom:5px}
.cite {font-family:Tahoma,Arial,sans-serif; font-size:8pt}
</style></head>
<body bgcolor="#ffffff">
<span class="heading">Create Password Hash for web.config File</span><hr />
<!--------------------------------------------------------------------------->

<form runat="server">
  Password Format:
  <input type="radio" value="SHA1" name="chkFormat" checked="true" runat="server" />
  SHA1 &nbsp;
  <input type="radio" value="MD5" name="chkFormat" runat="server" />
  MD5<p />
  Password: <input id="txtPwd" type="text" runat="server" /><p />
  <input type="submit" value="Create Hash" runat="server" onserverclick="DoHashPassword" /><p />
  <div id="outMessage" runat="server" />
</form>
</body>
</html>

<script language="VB" runat="server">
Sub DoHashPassword(objSender As Object, objArgs As EventArgs)

  Dim strHash, strFormat As String

  'get the format name as a string from the radio button value
  strFormat = Request.Form("chkFormat")

  'create the hash using the password value provided
  strHash = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPwd.Value, strFormat)

  'and display the result
  outMessage.InnerHtml = "<b>" & strFormat & "</b> Password Hash is: " _
                       & "<b>""" & strHash & """</b>"

End Sub
</script>
